{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">

                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-danger" type="button" onclick="wk.href('{:url('index')}');">
                            <i class="fa fa-mail-reply"></i> 返回分类列表
                        </button>

                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>

                    <!--修改状态模板-->
                    <!--<script type="text/html" id="staBar">-->
                        <!--<input type="checkbox" value="{{d.school_id}}"  lay-skin="switch"  lay-text="上架中|已下架" lay-filter="OnOff" {{ d.school_status == 1 ? 'checked' : '' }} >-->
                    <!--</script>-->

                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.good_thumb}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>

                    <!--状态显示模板-->
                    <script type="text/html" id="statBar">
                        {{# if(d.good_status == 1){ }}
                        上架中
                        {{# } }}
                        {{# if(d.good_status == 2){ }}
                        已下架
                        {{# } }}
                    </script>

                    <script type="text/html" id="typeBar">
                        {{# if(d.good_type == 1){ }}
                        非书籍
                        {{# } }}
                        {{# if(d.good_type == 2){ }}
                        书籍
                        {{# } }}
                    </script>

                    <!--操作模板-->

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Goodscate/goodsList")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left',}
                {type:'numbers', width: 60, title: '序号'}
                , {field: 'good_name', width: '', title: '商品名称', align: 'center'}
                , {field: 'good_price', width: '', title: '价格', align: 'center'}
                , {field: 'good_status', width: 80, title: '状态', align: 'center', toolbar: '#statBar'}
                , {field: 'good_type', width: 100, title: '种类', align: 'center', toolbar: '#typeBar'}
                , {field: 'good_thumb', width: 90, title: '缩略图', align: 'center', templet: '#imgTpl'}
                , {field: 'good_stock', width: 80, title: '库存', align: 'center'}
                , {field: 'good_coding', width: 140, title: '编码', align: 'center'}
                , {field: 'good_weight', width: 80, title: '重量', align: 'center'}
                , {field: 'good_cost', width: '', title: '成本价', align: 'center'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
    });
</script>
</body>
</html>
